<?php 
include "includes/session.php";
include "includes/comunes.php";
$sql="select * from veh_stock_articulo where id=".$_GET['pro_id'];
$resPro=  cons_sql_up($sql);
$regPro=mysql_fetch_array($resPro);
//OBTENGO EL NUMERO DE RECAPADO
if($regPro['IdAnterior']>0)
 $rec=obtener_recapado($regPro['IdAnterior'])+1;
 else
	$rec=1;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="refresh" CONTENT="300"/>
<title>Sistema de Registro de Atencion</title>

<link href="estilos.css" rel="stylesheet" type="text/css" />

<!--libreria jquery central-->

<script src="jquery-ui/js/jquery-1.9.1.js"></script>
<!--fin libreria central-->

<!--Librerias para el combo-->
<script language="JavaScript" type="text/javascript" src="combos/jquery.chainedSelects.js"></script>
<!--fin libreria-->

<!--librerias ui-->
<link href="jquery-ui/css/ui-lightness/jquery-ui-1.10.2.custom.css" rel="stylesheet"/>
<script src="jquery-ui/js/jquery-ui-1.10.2.custom.js"></script>
<!--fin libreria-->
<!--libreria flexigrid-->
<link rel="stylesheet" type="text/css" href="jquery-ui/css/ui-flexigrid/flexigrid.css">
    <script type="text/javascript" src="jquery-ui/js/flexigrid.js"></script>
<!--fin libreria-->
<!--VENTANA MODAL -->
<link href="modal/styles/modal-window.css" type="text/css" rel="stylesheet" /> 
 
		<script type="text/javascript" language="javascript" src="modal/scripts/modal-window.min.js"></script>  
<!--
  fin estilo scroll-->
<!--
  fin estilo scroll-->


<script language="JavaScript" type="text/javascript">
$(function()
{

//        funcion que implementa combos
	$('#rubro').chainSelect('#subrubro','comborubrosubrubro.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
	
	$('#marca').chainSelect('#temporada','combomarcatemporada.php',
	{
		before:function (target) //before request hide the target combobox and display the loading message
		{
			$("#loading").css("display","block");
			$(target).css("display","none");
		},
		after:function (target) //after request show the target combobox and hide the loading message
		{
			$("#loading").css("display","none");
			$(target).css("display","inline");
		}
	});
        
    $( "#menu" ).menu({position: {at: "left bottom"}});
           
		$("#codigo").autocomplete({
			source: "autoArticulos.php"
		});   
		

});
</script>

</head>

<body>

<div class="container">
<?php include "includes/head.php"?>
   <div class="content">
       <div class="tituloprincipal">
          <?php include 'includes/submenu.php';?>  
           <img src="img/ruedas.jpg" width="25" height="25" border="0"/> Ingresar Cubierta Recapada <?php echo $regPro['Codigo']." ".utf8_encode($regPro['Nombre'])?>
           </div>
       <form id="pedido" name="pedido" method="POST" action="grabarRecapado.php">
	   <input type="hidden" class="campo_form"  value="<?php echo $regPro['id']?>" id="id" name="id" required>
       <div class="contenedorpedido">
           <div id="vendedor">
           <fieldset>
              <legend><b>Datos del Producto</b></legend> 
               <table  width="100%">
                 <tr>
                      <td class="textotablamenuform">Codigo</td>
                      <td class="textotablamenuform">
					    
                          <input type="text" class="campo_form"   value="<?php echo "REC".$rec.$regPro['Codigo']?>" id="codigo" name="codigo" required>
					
						   <input type="hidden" class="campo_form"  value="<?php echo $regPro['Codigo']?>" id="codigoViejo" name="codigoViejo" required>
						  <!-- <input type="hidden" class="campo_form"  value="<?php //echo "REC".$rec.$regPro['Codigo']?>" id="codigo" name="codigo" required>-->
						
						  <input type="hidden" class="campo_form"   value="<?php echo $regPro['Rubro']?>" id="rubro" name="rubro" required>
						  <input type="hidden" class="campo_form"   value="<?php echo $regPro['Subrubro']?>" id="subrubro" name="subrubro" required>
						   <input type="hidden" class="campo_form"   value="<?php echo $regPro['Marca']?>" id="marca" name="marca" required>
						   <input type="hidden" class="campo_form"   value="<?php echo $regPro['StockMinimo']?>" id="stock" name="stock" required>
						   <input type="hidden" class="campo_form"   value="<?php echo $regPro['id']?>" id="id" name="id" required>
						   <input type="hidden" class="campo_form"   value="<?php echo $regPro['Tipo']?>" id="tipo" name="tipo" required>
						   <input type="hidden" class="campo_form"   value="<?php echo $rec?>" id="recapada" name="recapada" required>
                      </td>
                      <td class="textotablamenuform"></td>
                      <td class="textotablamenuform">
                      </td>
                      
                 </tr>
                   <tr>
                      <td class="textotablamenuform">Descripcion</td>
                      <td class="textotablamenuform" colspan="5">
                           <input type="text" class="campo_form"  value="REC <?php echo $rec." - ".utf8_encode($regPro['Nombre'])?>" id="nombre" name="nombre" required>
                               
                      </td> 
                   </tr>
                   
                   <tr>
                      <td class="textotablamenuform">Costo</td>
                      <td class="textotablamenuform">
                          <input type="number" step="0.1" class="campo_form" required id="costo" value="<?php echo $regPro['Costo']?>" name="costo">
                      </td>
					  
					   <td class="textotablamenuform">Iva</td>
                      <td class="textotablamenuform">
                          <input type="number" step="0.1" class="campo_form" required id="iva" value=" " name="iva">
                      </td>



					  </tr>
					  
					  <tr>
                      <td class="textotablamenuform" colspan="4"><HR></td>
                                        
                     
					  </tr>
					  <tr>
					   <td class="textotablamenuform">Proveedor</td>
				  <td class="textotablamenuform" colspan="3">
                           <select class="campo_form" name="proveedor" id="proveedor" required>
						  
						   <?php 
						   $resProv=obtener_prov_vehiculos();
						   while($regProv=mysql_fetch_array($resProv)):
						   if($regPro['Proveedor']==$regProv['ProveedorId']):?>
						   <option value="<?php echo $regProv['ProveedorId']?>" selected><?php echo utf8_encode($regProv['ProveedorNombre'])?></option>
						   <?php else: ?>
						   <option value="<?php echo $regProv['ProveedorId']?>"><?php echo utf8_encode($regProv['ProveedorNombre'])?></option>
						   <?php endif ?>
						   <?php endwhile ?>
						  </select>
                    
                      </td>
                      
                     
                 </tr>
				<tr>

                    <td class="textotablamenuform">Fecha</td>
                    <td class="textotablamenuform"><input type="text" name="fecha" id="fecha"  value="<?php echo format_fec(date("Y-m-d"),"/")?>" class="campo_form" /></td>
                    <td class="textotablamenuform"> Nro Orden Proveedor</td>
                    <td class="textotablamenuform" colspan="3">
					<input type="text" name="numero" id="numero" value="0" required class="campo_form" />
					 
						  </td>
                    
<td class="textotablamenuform"></td>				
                 </tr>
				 
				 <tr>
                      <td class="textotablamenuform">Sucursal</td>
                     <td class="textotablamenuform" colspan="5">
                          <select class="campo_form" name="sucursal" id="sucursal" required>
						   
						   <?php 
						   $resRub=obtener_sucursales();
						   while($regRub=mysql_fetch_array($resRub)):?>
						   <option value="<?php echo $regRub['sucursalId']?>"><?php echo utf8_encode($regRub['sucursalNombre'])?></option>
						   <?php endwhile ?>
						  </select>
                     </td>
                     
                    
                 </tr>
                 <tr>
                    <td class="textotablamenuform">Observacion </td>
                    <td class="textotablamenuform" colspan="3"><input type="text" name="observacion" id="observacion" value="" class="campo_form" /></td>
                    
                        </tr>
                   
                   
                   
               </table>    
           </fieldset>  
           </div>
           
        
           <fieldset style="text-align: right;">  
            <table style="text-align: right;">
             <tr>
                    <td class="textotablamenuform" style="text-align: right;" colspan="5">
                         <input name="submit" id="submit" type="submit" value="Ingresar al Stock y Registrar Orden de Compra" class="boton_form"/>
                     </td>
                 </tr>
                   </table>       
           </fieldset>  
           
           
           
       </div>
   </form>
       <div class="clear"></div>
   <br>
   </div>
  <?php include "includes/pie.php"?>
  
</div>
</body>
</html>
